﻿using System.Data.Entity.ModelConfiguration;
using yiCommerce.Core.Domain.Products;

namespace yiCommerce.Data.Mapping.Products
{
    public class SpecificationAttributeOptionMapping : EntityTypeConfiguration<SpecificationAttributeOption>
    {
        public SpecificationAttributeOptionMapping()
        {
            this.ToTable("SpecificationAttributeOption");
            this.HasKey(sao => sao.Id);
            this.Property(sao => sao.Name).IsRequired();
            
            this.HasRequired(sao => sao.SpecificationAttribute)
                .WithMany(sa => sa.SpecificationAttributeOptions)
                .HasForeignKey(sao => sao.SpecificationAttributeId);
        }
    }
}